package com.lcz.authority.common.service.file;

import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author lcz
 * @desc 文件选择
 * @mail lcz_0130@163.com
 * @date 2024/05/07
 */

@Service
public class FileContext {
    @Resource
    private Map<String, FileOperatorApi> strategyMap;

    public String execute(String strategy, MultipartFile file) {
        return strategyMap.get(strategy).upload(file);
    }

    public String execute(String strategy, String bucketName, MultipartFile file) {
        return strategyMap.get(strategy).upload(bucketName, file);

    }

    public String execute(String strategy, String bucketName, MultipartFile file, String[] allowedExtension) {
        return strategyMap.get(strategy).upload(bucketName, file, allowedExtension);

    }

}
